package com.ksm.web.controller.version;

import com.ksm.common.core.controller.BaseController;
import com.ksm.common.core.domain.AjaxResult;
import com.ksm.common.core.page.TableDataInfo;
import com.ksm.version.domain.SysVersionManage;
import com.ksm.version.domain.vo.ProjectVo;
import com.ksm.version.service.ProjectService;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

@RestController
public class ProjectController extends BaseController {

    @Autowired
    private ProjectService service;


    @GetMapping("/api/project/findAll")
    public TableDataInfo findAll() {
        startPage();
        return getDataTable(service.findAll());
    }

    @GetMapping("/api/project/findAllOp")
    public AjaxResult findAllOp() {

        return AjaxResult.success(service.findAll());
    }

    @PutMapping("/api/project/addProject")
    public AjaxResult addProject(@RequestBody ProjectVo projectVo) throws ParseException {

        return AjaxResult.success(service.addNewProject(projectVo));
    }
}
